export function getContractHtml(data, keys) {
  let itemHtml = keys.map(item => {
    let text = data[item.key]
    if (item.key=='bournDtoList'){
      text=getBournHtml(data)

    }
    if(text) {
      text = text.replace(/<br\/>\n/g,"<br/>")
    }
    return `
<div class="item">
<div class="label">${item.label}:</div>
<div class="text">${text || ""}</div>
</div>
    `
  })
  return `${itemHtml.join("")}`
}
//目的地地接社
export function getBournHtml(data){
  let itemHtml=``;
  if (data.bournDtoList){
    for (let i = 0; i < data.bournDtoList.length; i++) {
      let bourn=data.bournDtoList[i]
      if (bourn.bournReception!=null){
        itemHtml+=``+bourn.bournReception+`&nbsp;`;
      }else{
        itemHtml+=`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`;
      }

      if (bourn.bourn!=null){
        itemHtml+=``+bourn.bourn+`&nbsp;`;
      }else{
        itemHtml+=`&nbsp;`;
      }
      if (bourn.linkman!=null){
        itemHtml+=``+bourn.linkman+`&nbsp;`;
      }else{
        itemHtml+=`&nbsp;`;
      }
      if (bourn.linktel!=null){
        itemHtml+=``+bourn.linktel+`&nbsp;`;
      }else{
        itemHtml+=`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`;
      }
      if (bourn.licence!=null){
        itemHtml+=``+bourn.licence+`&nbsp;`;
      }else{
        itemHtml+=`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`;
      }
      if (bourn.locationInfo!=null){
        itemHtml+=``+bourn.locationInfo+`</br>`;
      }
    }
  }
  return itemHtml

}
export function getPlanHtml(data){
  let itemHtml = data.map(item => {
    if(item.content) {
      item.content = item.content.replace(/<br\/>\n/g,"<br/>")
    }
    return `
      <div style="display:flex;padding-bottom: 10px;">
        <span style="display:inline-block;width:120px;font-weight:bold;flex-shrink:0;padding-left: 4px">第${ item.dayNum }天</span>
        <span style="width:100%;border-bottom: 1px solid #fafafa; padding-bottom: 4px">
          <span style="font-weight: bold;">区间：</span>${ item.areaRegion }
          <span style="font-weight: bold;margin-left: 20px">住宿：</span>${item.stay}
          <span style="font-weight: bold;margin-left: 20px">用餐：</span>${ item.eating }
        </span>
      </div>
      <div style="margin-left: 120px;">
          <span style="font-weight: bold;">交通：</span>
          ${ item.trafic }
        </div>
        <div style="margin-left: 120px; white-space: pre-wrap; word-wrap: break-word; word-break: break-all; line-break: anywhere;">${item.content}</div>
    `
  })
  return `${itemHtml.join("")}`
}


export const htmlKey1 = [
  {
    label: "费用包含",
    key: "costInclude"
  },
  {
    label: "费用不含",
    key: "fixLimit"
  },
  {
    label: "退款说明",
    key: "refound"
  }
]

export const htmlKey2 = [
  {
    label: "集合地点",
    key: "gatherPlace"
  },
  {
    label: "出行警示说明",
    key: "tourCautionIntro"
  },
  {
    label: "备注说明",
    key: "priceIntro"
  },
  {
    label: "其他注意事项",
    key: "tourRemark"
  },
  {
    label: "目的地地接社",
    key: "bournDtoList"
  },
  {
    label: "旅游费用指定收款账号",
    key: "payInfo"
  }
]
